﻿using System;
using System.Collections.Generic;
using System.Threading;

namespace Program09
{
    
    internal class Program
    {
        //随机初始化不少于100个员工，随机生成一线中文姓名
        public static List<Person> GetPersons()
        {
            var list = new List<Person>();

            //100个员工
            for(var i = 0; i < 100; i++)
            {
                var fName = "";
                var lName = "";
                _GetRandomChineseName(ref fName, ref lName);
                var p = new Person()
                {
                    EmployeeNo = "Lzzy" + (i + 1).ToString("0000"),
                    FirstName = fName,
                    LastName = lName,
                    Phone = "13888888" + i.ToString("0000")
                };
                list.Add(p);

                Thread.Sleep(1);
            }
            return list;
        }
        /// <summary>
        /// 随机生成中文姓名
        /// </summary>
        /// <param name="fName"></param>
        /// <param name="lNmae"></param>
        private static void _GetRandomChineseName(ref string fName,ref string lName)
        {
            string[] _fNames = new string[]
            {
                "白","毕","卞","蔡","曹","岑","常","车","陈","成" ,"程","池","邓","丁","范","方","樊","费","冯","符"
                ,"傅","甘","高","葛","龚","古","关","郭","韩","何" ,"贺","洪","侯","胡","华","黄","霍","姬","简","江"
                ,"姜","蒋","金","康","柯","孔","赖","郎","乐","雷" ,"黎","李","连","廉","梁","廖","林","凌","刘","柳"
                ,"龙","卢","鲁","陆","路","吕","罗","骆","马","梅" ,"孟","莫","母","穆","倪","宁","欧","区","潘","彭"
                ,"蒲","皮","齐","戚","钱","强","秦","丘","邱","饶" ,"任","沈","盛","施","石","时","史","司徒","苏","孙"
                ,"谭","汤","唐","陶","田","童","涂","王","危","韦" ,"卫","魏","温","文","翁","巫","邬","吴","伍","武"
                ,"席","夏","萧","谢","辛","邢","徐","许","薛","严" ,"颜","杨","叶","易","殷","尤","于","余","俞","虞"
                ,"元","袁","岳","云","曾","詹","张","章","赵","郑" ,"钟","周","邹","朱","褚","庄","卓"
            };
            string _lNames = "清明时节雨纷纷路上行人欲断魂借问酒家何处有牧童遥指杏花村海上生明月天涯共此时情人怨遥夜竟夕起相思灭烛怜光满披衣觉露滋不堪盈手赠还寝梦佳期";
            var rnd = new Random(DateTime.Now.Millisecond);
            fName = _fNames[rnd.Next(_fNames.Length - 1)];
            lName = _lNames.Substring(rnd.Next(0, _lNames.Length - 1), 1) +
                _lNames.Substring(rnd.Next(0, _lNames.Length - 1), 1);

        }
        private static void Main(string[] args)
        {
            //var firstName = "";
            //var lastName = "";
            //_GetRandomChineseName(ref firstName, ref lastName);
            //Console.WriteLine(firstName + lastName);

            var list = GetPersons();
            foreach (var p in list)
            {
                Console.WriteLine("工号：{0}  姓名：{1}  性别：{2}  生日：{3}  手机：{4}",
                    p.EmployeeNo, p.FullName, p.Sex ? "男" : "女", p.BirthDay.ToString("yyyy年M月d日"), p.Phone);
            }
        }
    }
}
